<template>
  <div class="icon-list-container">
    <div class="item" v-for="(item, index) in list" :key="index">
      <div class="icon" :style="{ backgroundColor: item.bgColor }">
        <span
          :class="['iconfont', item.fontClass]"
          :style="{ color: item.color }"
        ></span>
      </div>
      <div class="right">
        <div class="text">{{ item.text }}</div>
        <div class="num">{{ item.num }}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'icon-item',
  props: {
    list: {
      type: Array,
      required: true,
      default: () => [],
    },
  },
}
</script>

<style lang="scss" scoped>
.icon-list-container {
  float: left;
  width: 30%;
  border-radius: 4px;
  .item {
    display: inline-block;
    width: 48.5%;
    height: 70px;
    min-width: 100px;
    background-color: #f7f7f7;
    margin-bottom: 12px;
    padding: 10px;
    padding-right: 0;
    box-sizing: border-box;
    border-radius: 4px;
    &:nth-child(2n) {
      margin-left: 3%;
    }
    .icon {
      float: left;
      width: 50px;
      height: 50px;
      text-align: center;
      line-height: 50px;
      .iconfont {
        font-size: 28px;
      }
    }
    .right {
      margin-left: 6px;
      float: left;
      .text {
        margin-top: 4px;
        font-size: 13px;
      }
      .num {
        margin-top: 6px;
        font-size: 16px;
        font-weight: 600;
      }
    }
  }
}
</style>
